package interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import controller.TipAction;

import java.util.Calendar;

public class TipInterceptor extends AbstractInterceptor {

    @Override
    public String intercept(ActionInvocation invocation) throws Exception {

        Calendar calendar=Calendar.getInstance();
        System.out.println("tipInter");
        int cal=calendar.get(Calendar.HOUR_OF_DAY);
        if (cal>9&&cal<12){
            return "tip";
        }
        return invocation.invoke();
    }
}
